package com.whfc.hdc.dao;

import com.whfc.hdc.dto.AppDeviceUpgradeDTO;
import com.whfc.hdc.entity.AppDeviceUpgrade;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AppDeviceUpgradeMapper {

    AppDeviceUpgrade selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AppDeviceUpgrade record);

    /**
     * 通过升级包查询升级硬件
     *
     * @param packageId
     * @return
     */
    List<AppDeviceUpgradeDTO> selectUnCompletedByPackageId(@Param("packageId") Integer packageId);

    /**
     * 通过升级包查询升级硬件
     *
     * @param packageId
     * @param state
     * @return
     */
    List<AppDeviceUpgradeDTO> selectByPackageIdAndState(@Param("packageId") Integer packageId, @Param("state") Integer state);

    /**
     * 通过升级包查询升级硬件
     *
     * @param packageId
     * @return
     */
    List<AppDeviceUpgradeDTO> selectByPackageId(@Param("packageId") Integer packageId);

    /**
     * 查询设备的版本升级信息
     *
     * @param deviceId
     * @return
     */
    AppDeviceUpgradeDTO selectUpgradeByDeviceId(@Param("deviceId") Integer deviceId);

    /**
     * 查找设备升级信息
     *
     * @param deviceId
     * @return
     */
    AppDeviceUpgrade selectByDeviceId(@Param("deviceId") Integer deviceId);

    /**
     * 批量插入
     *
     * @param upgradeList
     * @return
     */
    int batchInsert(@Param("upgradeList") List<AppDeviceUpgrade> upgradeList);

    /**
     * 逻辑删除
     *
     * @param id
     * @return
     */
    int logicDeleteById(@Param("id") Integer id);

    /**
     * 逻辑删除
     *
     * @param deviceId
     * @return
     */
    int logicDeleteByDeviceId(@Param("deviceId") Integer deviceId);

    /**
     * 逻辑删除
     *
     * @param deviceIdList
     * @return
     */
    int logicDeleteByDeviceIdList(@Param("deviceIdList") List<Integer> deviceIdList);
}